package com.zy.design.ocp.ns;

import com.zy.design.ocp.base.Notification;
import com.zy.design.ocp.base.NotificationEmergencyLevel;

/**
 * @author zhaoyi
 * @date 2021/3/15 18:04
 */
public class ErrorAlertHandler extends AlertHandler {

    public ErrorAlertHandler(AlertRule2 rule, Notification notification) {
        super(rule, notification);
    }

    @Override
    public void check(ApiStatInfo apiStatInfo) {
        if (apiStatInfo.getErrorCount() > rule.getMatchedRule(apiStatInfo.getApi()).getMaxErrorCount()) {
            notification.notify(NotificationEmergencyLevel.SEVERE, "... ErrorAlertHandler ");
        }

    }
}
